package com.atguigu.comtroller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class HelloController {
    @PreAuthorize("hasAnyAuthority('add','insert')")
    @RequestMapping("/add")
    public String add(){
        return "add";
    }

    @PreAuthorize("hasAnyAuthority('delete')")
    @RequestMapping("/delete")
    public String delete(){
        return "delete";
    }
    @PreAuthorize("hasAnyAuthority('edit','update')")
    @RequestMapping("/edit")
    public String edit(){
        return "edit";
    }
    @PreAuthorize("hasAnyAuthority('query')")
    @RequestMapping("/query")
    public String query(){
        return "query";
    }

    /*@RequestMapping("/logout.do")
    public String logout(HttpSession session){
        session.invalidate();
    }*/
}
